#ifndef AUDITTRAILMODEL_H
#define AUDITTRAILMODEL_H

#include <QAbstractTableModel>
#include "auditlogger.h"
#include <QVector>
#include "auditlogger.h"

class AuditTrailModel : public QAbstractTableModel
{
    Q_OBJECT

public:
    explicit AuditTrailModel(AuditLogger *logger, QObject *parent = nullptr);

    // 基本模型接口
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

    // 自定义方法
    void refresh();
    void setAuditRecords(const QVector<AuditLogger::AuditRecord> &records);

private:
    AuditLogger *m_logger;
    QVector<AuditLogger::AuditRecord> m_records;
};

#endif // AUDITTRAILMODEL_H